package pl.mchaniewski.ryneczek.web;

import javax.faces.event.ComponentSystemEvent;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import pl.mchaniewski.ryneczek.utilities.FacesUtil;
import pl.mchaniewski.ryneczek.utilities.NavigationUtil;

@Component
@Scope("request")
public class SuccessBean {

    public void check(ComponentSystemEvent event) {
        if (!FacesUtil.getFlashScope().containsKey("login")) {
            NavigationUtil.directRedirect(NavigationUtil.DIRECT_INDEX);
        }
    }

}
